# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Tim S. <stahta01@gmail.com>

_realname=kicad-doc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}-ca"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-de"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-en"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-es"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-fr"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-id"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-it"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ja"
         # "${MINGW_PACKAGE_PREFIX}-${_realname}-nl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-pl"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-ru"
         "${MINGW_PACKAGE_PREFIX}-${_realname}-zh")
pkgver=5.1.5
pkgrel=1
pkgdesc="Documentation for KiCad (mingw-w64)"
arch=("any")
url="http://www.kicad-pcb.org"
license=("GPL3" "custom")
makedepends=()
optdepends=("${MINGW_PACKAGE_PREFIX}-kicad-meta"
            "${MINGW_PACKAGE_PREFIX}-kicad")
options=('!strip')

source=("https://kicad-downloads.s3.cern.ch/docs/kicad-doc-${pkgver}.tar.gz")
sha256sums=('477ad2ac29e70eccf1155cdca887280d1c74767b9444f7d38b5ec701fee17dc5')

build_lang() {
  cd "${srcdir}/kicad-doc-${pkgver}/share/doc/kicad/help"
  mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
  cp -R ${langid} "${pkgdir}${MINGW_PREFIX}/share/doc/kicad/help/"
}

for _n in ${pkgname[@]}; do
  eval "package_${_n}() {
    langid="${_n#${MINGW_PACKAGE_PREFIX}-${_realname}-}" build_lang
  }"
done
